When you create a new buffer, its style will be set from
c-default-style. The factory default is the style
gnu, except in Java and AWK modes where it's
java and awk.
Remember that if you set a style variable with the Customization interface or at the top level of your .emacs file before the style system is initialized (see Config Basics), this setting will override the one that the style system would have given the variable.
To set a buffer's style interactively, use the command C-c . (see Other Commands). To set it from a file's local variable list, File Styles.
This variable specifies which style to install by default in new buffers. It takes either a style name string, or an association list of major mode symbols to style names:
- When
c-default-styleis a string, it must be an existing style name. This style is then used for all modes.- When
c-default-styleis an association list, the mode language is looked up to find a style name string.- If
c-default-styleis an association list where the mode language mode isn't found then the special symbol ‘other’ is looked up. If it's found then the associated style is used.- If ‘other’ is not found then the ‘gnu’ style is used.
In all cases, the style described in
c-default-styleis installed before the language hooks are run, so you can always override this setting by including an explicit call toc-set-stylein your language mode hook, or inc-mode-common-hook.The standard value of
c-default-styleis((java-mode . "java") (awk-mode . "awk") (other . "gnu")).